<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>

        // 组合继承
        //    把借用构造函数继承 + 原型链继承   --- 解决了子类向父类传参的问题 ，
        //        原型链上依然会出现多余的属性 --- 不影响

        function Dog(name, age) {
            this.name = name;
            this.age = age;
            this.type = '狗';
        }

        Dog.prototype.say = function () {
            console.log('汪');
        }


        function KeJi(name, age, color) {

            // 把Dog当做普通函数进行调用   this -> window
            Dog.call(this, name, age)

            this.color = color;
        }


        KeJi.prototype = new Dog('cc' , 2) ;



        const k = new KeJi('旺财' , 20 , '白色') ;

        console.log(k);


    </script>

</body>

</html>